<?php

require_once(PATH_CLASS.'widget.class.php');
require_once(PATH_CLASS.'news.class.php');

class loliNews extends widget{
  
  const CLASS_NAME = 'loliNews';
  
  public function getDefaults() {
    $ret = parent::getDefaults();
    $ret = array_merge(array(
       'saison_id'  => null
      ,'type'       => null
      ,'limit'      => 3
      ,'pars'       => array()
    ),$ret);
    
    return $ret;
  }
  
  protected function _get_called_class() { return self::CLASS_NAME;  }
  
  public function _render() {
    $pars = $this->params;
   
    $news = news::getActiveNews();
    
    $params = array('newsTb'=>$news);
    
    $params = array_merge($params,$pars);

    $layout = $this->renderTplFromFile(__FILE__, $params);

    return $layout;
    
  }
}

